const express = require('express')
const {
	list: funcList,
	add: funcAdd,
	modify: funcModify,
	del: funcDel,
	funcModule,
} = require('../modules/module-func')

const router = express.Router()

// /cms/func/list
router.post('/func/list', function(req, res, next) {
	return funcList(req).then(result => {
		return res.type('json').send(result)
	})
})

// /cms/func/add
router.post('/func/add', function(req, res, next) {
	return funcAdd(req).then(result => {
		return res.type('json').send(result)
	})
})

// /cms/user/modify
router.post('/func/modify', function(req, res, next) {
	return funcModify(req).then(result => {
		return res.type('json').send(result)
	})
})

// /cms/func/del
router.post('/func/del', function(req, res, next) {
	return funcDel(req).then(result => {
		return res.type('json').send(result)
	})
})

// /cms/func/module
router.post('/func/module', function(req, res, next) {
	return funcModule(req).then(result => {
		return res.type('json').send(result)
	})
})

module.exports = router